---
# Configuration for the fedbadges consumer

- name: install needed packages
  yum: pkg=$item state=installed
  with_items:
  - python-fedbadges
  - python-psycopg2
  tags:
  - packages

- name: copy database configuration
  template: >
    src=$item dest=/etc/fedmsg.d/$item
    owner=fedmsg group=fedmsg mode=0600
  with_items:
  - datanommer.py
  - badges-awarder.py
  tags:
  - config
  notify:
  - restart fedmsg-hub

- name: make badge definition directory
  file: >
    path=/usr/share/badges/rules
    state=directory
    owner=fedmsg group=fedmsg mode=0755
  tags:
  - config
  - badges

- name: copy over all our badge definitions
  copy: >
    src=$item
    dest=/usr/share/badges/rules/
    owner=fedmsg group=fedmsg mode=0644
  with_fileglob:
  - /srv/web/infra/badges/rules/*.yml
  tags:
  - config
  - badges
  notify:
  - restart fedmsg-hub
